<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title> demo-图片切换</title>
    <!-- <link rel="stylesheet" href="./css/index.css"/> -->
  </head>

  <body>
    <div id="mask">
        <h2> 一个title</h2>
        <!-- 图片 src="./images/00.jpg-->
        <img :src="ImageArr[index]" alt="">
        <!-- 左箭头 实现点击后切换图片src减--> 
        <img @click="subIndex" v-show="index!=0" src="./images/prev.png" alt="" >
        <!-- 右箭头 当index到底就不显示了-->
        <img @click="addIndex" v-show="index<ImageArr.length-1" src="./images/next.png" alt="">
    </div>
    

    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>


    <script>
      new Vue({
        el:"#mask",
        data:{
          ImageArr: [ "./images/00.jpg",
          "./images/01.jpg",
          "./images/02.jpg",
          "./images/03.jpg",
          "./images/04.jpg",
          "./images/05.jpg",
          "./images/06.jpg",
          "./images/07.jpg",
          "./images/08.jpg",
          "./images/09.jpg",
          "./images/10.jpg"
        ],
        index: 0 //来设置索引
        },
        methods: {
          subIndex:function(){
            this.index--;
          },
          addIndex:function(){
            this.index++;
          }
        
        },

      })
    </script>

    <!-- data是这个Vue实例中使用到的数据。用什么就写什么 -->
  </body>
</html>
